//
//  HHCitiesTableViewController.m
//  ZLFastDoctor
//
//  Created by 虎虎 on 16/5/23.
//  Copyright © 2016年 LS. All rights reserved.
//

#import "HHCitiesTableViewController.h"
#import "HHProvince.h"
#import "NQHomeVc.h"

@interface HHCitiesTableViewController ()<UITableViewDelegate>

@end
static NSString *ID = @"cities";
@implementation HHCitiesTableViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    [self.tableView registerClass:[UITableViewCell class] forCellReuseIdentifier:ID];
//    self.tableView.dataSource = self;
//    self.tableView.delegate = self;
    
}
#pragma mark - 数据源方法
- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView {
    return 1;
    
}
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {
    return self.cities.count;
    
}
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
    
    UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:ID forIndexPath:indexPath];
    if (cell == nil) {
        cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleSubtitle reuseIdentifier:ID];
    }
    //设置cell的数据
    cell.textLabel.text = self.cities[indexPath.row];
    return  cell;
    
}
#pragma mark - 代理方法
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {
//    
//     NQHomeVc *vc = [[NQHomeVc alloc] init];
//    
//     vc.city_name = self.cities[indexPath.row];
    
    [[NSNotificationCenter defaultCenter] postNotificationName:WheatherBtnChanged object:nil userInfo:@{@"key":self.cities[indexPath.row]}];
    
    [self.navigationController popToRootViewControllerAnimated:YES];

    
}
- (void)dealloc {
    NSLog(@"xxxxxx");
}

#pragma mark - 懒加载
- (NSArray *)cities {
    if (_cities == nil) {
        _cities = [NSArray array];
    
    }
    return _cities;

}

@end
